/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */

#ifndef LIB2D_HARD_SHIFTSTACK_H
#define LIB2D_HARD_SHIFTSTACK_H

#include <vector>
#include <lib2d/math.h>

namespace liba
{

namespace lib2d
{

namespace hard
{

class ShiftStack
{
	std::vector< Vector2 > shifts;
public:
	ShiftStack()
	{
		shifts.push_back( Vector2( 0, 0 ) );
	}
	void push_add( const Vector2 & shift )
	{
		shifts.push_back( top() + shift );
	}
	void push( const Vector2 & shift )
	{
		shifts.push_back( shift );
	}
	void pop()
	{
		if( shifts.size() > 1 )
			shifts.pop_back();
	}
	const Vector2 & top()const
	{
		return shifts.back();
	}
};

} //namespace hard
} //namespace lib2d
} //namespace liba

using namespace liba;

#endif //LIB2D_HARD_SHIFTSTACK_H

